For Each...Next

Note: This statement is not available in the Add Statement dialog box or the Statements pane.

Repeats a block of statements once for each element in a group, such as an array.

During playback, statements in the loop run once and then repeat using each element in the group. After statements in the loop run for each element, the script continues with the first statement outside of the block.

To use a counter and loop through a block of statements a specific number of times, use the For...Next statement.

Syntax

For Each Element In Group

[Statements]

Next Element

Arguments

Argument Description
Element Item in a collection or array. Must be a variable name.
Group Collection or array name.
Statements One or more statements that repeat for each item in the group.

Example

itemList = Window("BugReporter Dialog").ComboBox("comboboxType").Property("ListItems")

For Each item In itemList

PrintLn (item)

Next

Window("BugReporter Dialog").Close()